<?php 

session_start();
include_once("../includes/config.php");
include_once("../includes/mod_function.inc.php");

global $TOP_CONTENT_CATEGORY_SID,$TOP_AREA_CATEGORY_SID,$VERIFY_MOTHER_IMAGE_PATH,$VERIFY_MOTHER_IMAGE_NAME ;
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
$_DEBUG = false;

$puri = $_REQUEST['uri'];
$pverify_site_image_path = $puri.$VERIFY_MOTHER_IMAGE_NAME;

$ptype='profile';
$paction = $_REQUEST['action'];

global $foxydb;
$foxydb->open();

$site = $foxydb->findSiteByUri($puri);
if($site){
	if( $paction == 'updprofile'){
		$updateProfileResult = $foxydb->updateSiteProfile($site['sid'],$_REQUEST['name'],$_REQUEST['desc'],$_REQUEST['contact'],$_REQUEST['searchpath'],$_REQUEST['rsspath']);
	}
}else{
  $_SESSION['isWebMaster'] = false;
}

$foxydb->close();

if($updateProfileResult) header( 'Location: updatecat.php?action=search&uri='.$puri ) ;

include_once("../includes/header.php");
include_once("../includes/searchbox.php");
include_once("verifyinfo.php");
?>


<?php 
  if ($_SESSION['isWebMaster'] && $site ){?>
  <hr>
  <table align=center width="100%" cellpadding=0 cellspacing=0>

    <?php include("menu.php");	?>
    <tr>
      <td>
        <form action='updateprofile.php' method='POST' cellpadding=0 cellspacing=0>
          <INPUT type='hidden' name='uri' value='<?php echo $puri; ?>'/>
          <input type='hidden' name='action' value='updprofile'/>
          <TABLE align=left width="100%" cellpadding=0 cellspacing=0>
            <TR>
              <TD nowrap='true' align='right'>网站名称：</TD>
              <TD><INPUT TYPE="text" NAME="name" value='<?php echo $site['name'];?>'></TD>
              <TD></TD>
            </TR>
            <TR>
              <TD nowrap='true' align='right'>联系方式：</TD>
              <TD><INPUT TYPE="text" NAME="contact" value='<?php echo $site['contact'];?>' size="30">（可选填，如：Email、QQ、MSN、电话等。）</TD>
              <TD></TD>
            </TR>
			<TR>
			  <TD width="1%" nowrap  align='right' valign="top">网站搜索：</TD>
			  <TD><INPUT TYPE="text" NAME="searchpath" value='<?php echo $site['searchpath'];?>' size="60"><br>（格式：http://www.yourwebsite.com/doublefox/search.do?q=）</TD>
			</TR>
			<TR>
			  <TD width="1%" nowrap  align='right' valign="top">网站RSS：</TD>
			  <TD><INPUT TYPE="text" NAME="rsspath" value='<?php echo $site['rsspath'];?>' size="60"><br>（格式：http://www.yourwebsite.com/your-rss-dir/rss-name.xml）</TD>
			</TR>
            <TR>
              <TD nowrap='true' align='right'>网站简介： </TD>
              <TD valign='top'><TEXTAREA NAME="desc" ROWS="3" COLS="50"><?php echo $site['description'];?></TEXTAREA>请将字数控制在 400 字以内</TD>
              <TD></TD>
            </TR>

            <TR>
              <TD></TD>
              <TD><INPUT TYPE="submit" name='submit' value='保存'></TD>
              <TD></TD>
            </TR>

          </TABLE>
        </form>
      </td>
    </tr>
	

</table>
<?php }else if (!$site){
?>
  <table align=center width="100%" cellpadding=0 cellspacing=0>
    <tr>
      <td valign=middle align=center>
        没有找到网址[<A href='<?php echo $puri;?>' target='_blank'><?php echo $puri;?>]</A>,<br>请<A href='registersite.php?uri=<?php echo $puri;?>'>登陆网址</A>
      </td>
    </tr>
  </table>
<?php
  }
?>

<?php include("../includes/footer.php");?>